
use "$temp/hssc_trends.dta", clear

global wf        m_age m_eduyr m_goodhlth m_pens m_ins
global hb        f_age f_eduyr f_goodhlth f_pens f_ins  
global household pid_c1_gender landrentout transinc hhnetasst

*Fig. 1 
*Trends for child quantity and quality in response to women's non-farm employment
***********************************************************************************************
***********************************************************************************************
duplicates drop pid_a_m year,force
xtset pid_a_m year
eventdd numchldtot   $wf $hb $household i.year, method(fe,vce(robust)) timevar(tmtotreat) baseline(-1) graph_op(title("(a) Number of children") xtitle("Time to event") xlabel(-6(1)5) graphregion(color(white)))

drop if pid==.
eventdd cagtest_cn   $wf $hb $household i.educag numchldtot_nonzero ratboy_hh i.year, method(fe,vce(robust)) timevar(tmtotreat) baseline(-1) graph_op(title("(b) Chinese test scores") xtitle("Time to event") xlabel(-6(1)5) graphregion(color(white)))
eventdd cagtest_math $wf $hb $household i.educag numchldtot_nonzero ratboy_hh i.year, method(fe,vce(robust)) timevar(tmtotreat) baseline(-1) graph_op(title("(c) Mathematics test scores") xtitle("Time to event") xlabel(-6(1)5) graphregion(color(white)))